# このスクリプトは， todo-dash を動作させる上で必要な
# DB と Table を作成するスクリプトです．

require 'mysql'

# DB 名
db_name = "todo_dash"

db = Mysql::new("localhost", "root", "")
db.query("CREATE DATABASE IF NOT EXISTS #{db_name}")
db.select_db(db_name)


# account 管理用
q_table = "CREATE TABLE IF NOT EXISTS accounts ("
q_table << "id bigint unsigned NOT NULL AUTO_INCREMENT,"
q_table << "name varchar(50),"
q_table << "password varchar(50),"
q_table << "ticket varchar(100),"
q_table << "expiration datetime,"
q_table << "PRIMARY KEY (id))"
db.query(q_table)


# コネクション切断
db.close

